<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .p01{
            width:200px;
            height:100px;
            background-color:green;
        }
    </style>
</head>

<body>
    <div id="box">

    </div>
  
    <script src="./js/react18.js"></script>
    <script src="./js/react-dom18.js"></script>
    <script src="./js/babel.min.js"></script>
    
    <script type="text/babel">

        // 创建一个根对象：
        let root = ReactDOM.createRoot(document.getElementById("box"));

        // 函数式组件：只要一个函数的返回值是jsx，那么，它就是组件（可以用标签的写法）
        
        function Person(props){
            return (
                <ul>
                    <li>姓名:{props.name}</li>
                    <li>性别:{props.sex}</li>
                    <li>年龄:{props.age}</li>
                </ul>
            )
        }

        const age = 12;

        const jsx = <Person name="刘梁涛" sex="男" age={age} />;



        // 把jsx渲染到根对象对应的dom容器里
        root.render(jsx);
        

    </script>
</body>

</html>